 $LOAD_PATH.unshift File.join(File.dirname(__FILE__),'../..','ext_pr1/lib')
 require 'ext_pr1_v4'

# Überprüfung ob ein Element innerhalb eines Intervalls ist
# within? ::= (val, lower, upper) :: Nat x Nat x Nat -> Bool where (val >= lower 
# and val <= upper)
#
# Test { (3,1,6) = true, (3,4,5) = false, (3.0,1,6) = Err, (3,1.0,6) = Err,
# (3,1,6.0) = Err, (3,3,3) = true, (3,5,4) = Err

def within?(val,lower,upper)
  check_pre((val.nat? and lower.nat? and upper.nat? and lower <= upper))
   (val >= lower and val <= upper) 
end